package com.hs.sfzy.mapper;

import com.hs.sfzy.entity.Reply;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ReplyMapper {
    //    插入数据
    int insert(Reply reply);

    //    通过id删除
    int delete(int id);

    //    更新某一条数据
    int update(Reply reply);

    //    查询所有
    List<Reply> selectAll(Reply reply);

    //    通过id查询
    Reply selectById(int id);


    //通过问题id查询所有的回复id
    @Select("select id from reply where question_id = #{questionId} ")
    List<Integer> getIdByQuestionId(Integer questionId);

    List<Reply> selectByQuestionId(Long id);

//    批量删除
    void deleteBeach(@Param("replyIds") List<Integer> replyIds);

    @Select("select * from reply where user_id = #{userId} ")
    List<Reply> findById(Long userId);
}
